/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package bean;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author mezouari
 */
@Entity
@Table(name = "vignite")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Vignite.findAll", query = "SELECT v FROM Vignite v"),
    @NamedQuery(name = "Vignite.findById", query = "SELECT v FROM Vignite v WHERE v.id = :id"),
    @NamedQuery(name = "Vignite.findByCode", query = "SELECT v FROM Vignite v WHERE v.code = :code"),
    @NamedQuery(name = "Vignite.findByMontant", query = "SELECT v FROM Vignite v WHERE v.montant = :montant"),
    @NamedQuery(name = "Vignite.findByDateFin", query = "SELECT v FROM Vignite v WHERE v.dateFin = :dateFin")})
public class Vignite implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "Id")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "Code")
    private int code;
    @Basic(optional = false)
    @Column(name = "Montant")
    @Temporal(TemporalType.DATE)
    private Date montant;
    @Basic(optional = false)
    @Column(name = "DateFin")
    @Temporal(TemporalType.DATE)
    private Date dateFin;
    @JoinColumn(name = "IdVehicule", referencedColumnName = "Id")
    @ManyToOne(optional = false)
    private Vehicule idVehicule;

    public Vignite() {
    }

    public Vignite(Integer id) {
        this.id = id;
    }

    public Vignite(Integer id, int code, Date montant, Date dateFin) {
        this.id = id;
        this.code = code;
        this.montant = montant;
        this.dateFin = dateFin;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public Date getMontant() {
        return montant;
    }

    public void setMontant(Date montant) {
        this.montant = montant;
    }

    public Date getDateFin() {
        return dateFin;
    }

    public void setDateFin(Date dateFin) {
        this.dateFin = dateFin;
    }

    public Vehicule getIdVehicule() {
        return idVehicule;
    }

    public void setIdVehicule(Vehicule idVehicule) {
        this.idVehicule = idVehicule;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Vignite)) {
            return false;
        }
        Vignite other = (Vignite) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "bean.Vignite[ id=" + id + " ]";
    }
    
}
